<?php
$con=mysqli_connect("localhost","root","youhanmo1997");
if(!$con){
	die("error:".mysqli_errno()) ;
}  
mysqli_select_db($con,"students_management");

$sql="UPDATE course_select SET ";
$sql.=" score = '".$_POST['score']."' WHERE ";

if(($_POST['cname']!="")&&($_POST['cid']=="")){
 $sql .="cname='".$_POST['cname']."';";
}else if(($_POST['cname']=="")&&($_POST['cid']!="")){
$sql .="cid='".$_POST['cid']."';";
}else if(($_POST['cname']!="")&&($_POST['cid']!="")){
	 $sql .="cid='".$_POST['cid']."' AND cname='".$_POST['cname'].";";
}


$result = mysqli_query($con,$sql);

if (!$result) {
 printf("Error: %s\n", mysqli_error($con));
 exit();
}

echo "Change Successfully!";
?>